clear all
set memo 100m
capture log close

local filename comparison

log using comparison, replace text

local output_dir draft
local output_tex1 `filename'.tex

cd "C:\Users\rujia\Dropbox\Replication\treatyports"

use "data\nonSubgroup.dta", clear

append using "data\subgroup.dta"
replace treatyports=1 if cmcyear<.
replace treatyports=0 if cmcyear==.





label var coastal2  "Coastal"
label var yangtze "Yangtze"
label var hpopu1776 "Popu in 1776"
label var hpopu1820 "Popu in 1820"
label var silk "Silk"
label var tea "Tea"
label var landtax "Land tax in 1820"
label var dis_yunhe1 "Distance to Grand Canal"
label var longitude "Longitude"
label var latitude "Latitude"
label var taipingrrebellion  "Affected by Taiping Rebellion"



gen non_treaty=1-treatyports


local vars0 "hpopu1776 hpopu1820 silk tea landtax  dis_yunhe1 longitude latitude taipingrrebellion"

eststo clear

bysort non_treaty: eststo: quietly estpost summarize `vars0', listwise

eststo: estpost ttest `vars0', by(non_treaty)

bysort non_treaty: eststo: quietly estpost summarize `vars0' if subgroup==., listwise

eststo: estpost ttest `vars0' if subgroup==., by(non_treaty)

esttab using draft/`output_tex1',  replace width(\hsize) cells("mean(fmt(2))" "sd(par fmt(2))" "t(star fmt(2))") label nodepvar  star(* 0.10 ** 0.05 *** 0.01)



